import java.util.*;

public class TestDiceRoll {
    public static void main(String[] args) {
        Scanner console = new Scanner(System.in);
        System.out.print("Desired dice sum: ");
        int sum = console.nextInt();
        
        // int roll will hold the value of die1 + die2
        int roll = 0;
        
        do {
            int die1 = (int) (Math.random() * 6) + 1;
            int die2 = (int) (Math.random() * 6) + 1;
            roll = die1 + die2;
            System.out.println(die1 + " and " + die2 + " = " + roll);
        }
        while (sum != roll);
    }
}